package com.xbongbong.pro.enums.menu.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.pro.enums.AccessLinkEnum;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;

/**
 * @author 吴峰
 * @date 2019/1/11 10:37
 * @desrcption 管理中心列表枚举类
 */
@Getter
public enum ControlCenterMenuEnum {

    /**
     * 管理中心列表枚举
     */
    APPLICATION_MANAGEMENT("applicationSet", "enum.controlCenterMenu.name.application_management", AccessLinkEnum.APPLICATION_MANMAGE.getIcon(), AccessLinkEnum.APPLICATION_MANMAGE.getUrl()),

    FORM_TEMPLATE("formSet", "enum.controlCenterMenu.name.form_template", AccessLinkEnum.FORM_TEMPLATE.getIcon(), AccessLinkEnum.FORM_TEMPLATE.getUrl()),

    PROCESS_SETTINGS("processSet", "enum.controlCenterMenu.name.process_settings", AccessLinkEnum.PROCESS_SETTINGS.getIcon(), AccessLinkEnum.PROCESS_SETTINGS.getUrl()),

    WORK_FLOW("workflow", "enum.controlCenterMenu.name.work_flow", AccessLinkEnum.WORK_FLOW.getIcon(), AccessLinkEnum.WORK_FLOW.getUrl()),

    ORGANIZATION_AUTHORITY("organizationSet", "enum.controlCenterMenu.name.organization_authority", AccessLinkEnum.ORGANIZATION_AUTHORITY.getIcon(), AccessLinkEnum.ORGANIZATION_AUTHORITY.getUrl()),

    MESSAGE_PUSH("pushSet", "enum.controlCenterMenu.name.message_push", AccessLinkEnum.MESSAGE_PUSH.getIcon(), AccessLinkEnum.MESSAGE_PUSH.getUrl()),

    PRINT_TEMPLATE("printTemplate", "enum.controlCenterMenu.name.print_template", AccessLinkEnum.PRINT_TEMPLATE.getIcon(), AccessLinkEnum.PRINT_TEMPLATE.getUrl()),

//    MENU_SETTINGS("menuSet", "enum.controlCenterMenu.name.menu_settings", AccessLinkEnum.MENU_SETTINGS.getIcon(), AccessLinkEnum.MENU_SETTINGS.getUrl()),

    WORK_ORDER("workOrderSet", "enum.controlCenterMenu.name.work_order", AccessLinkEnum.WORK_ORDER.getIcon(), AccessLinkEnum.WORK_ORDER.getUrl()),

    CALL_CENTER("callCenter", "enum.controlCenterMenu.name.call_center", AccessLinkEnum.CALL_CENTER.getIcon(), AccessLinkEnum.CALL_CENTER.getUrl()),

    SEARCH_CUSTOMER("searchCustomer", "enum.controlCenterMenu.name.search_customer", AccessLinkEnum.SEARCH_CUSTOMER.getIcon(), AccessLinkEnum.SEARCH_CUSTOMER.getUrl()),

    GROUP_MESSAGE("smsSet", "enum.controlCenterMenu.name.group_message", AccessLinkEnum.GROUP_MESSAGE.getIcon(), AccessLinkEnum.GROUP_MESSAGE.getUrl()),

    ESIGN("esignSet", "enum.controlCenterMenu.name.esign", AccessLinkEnum.ESIGN.getIcon(), AccessLinkEnum.ESIGN.getUrl()),

    OTHER_SETTINGS("otherSet", "enum.controlCenterMenu.name.other_settings", AccessLinkEnum.OTHER_SETTINGS.getIcon(), AccessLinkEnum.OTHER_SETTINGS.getUrl()),

    AI_ASSISTANT("aiAssistant", "enum.controlCenterMenu.name.ai_assistant", AccessLinkEnum.AI_ASSISTANT.getIcon(), AccessLinkEnum.AI_ASSISTANT.getUrl()),

    SERVICE_REGISTRATION("serviceRegister", "enum.controlCenterMenu.name.service_registration", AccessLinkEnum.SERVICE_REGISTRATION.getIcon(), AccessLinkEnum.SERVICE_REGISTRATION.getUrl()),

    DEVELOPER("developer", "enum.controlCenterMenu.name.developer", AccessLinkEnum.DEVELOPER.getIcon(), AccessLinkEnum.DEVELOPER.getUrl()),

    DATA_CONNECTION("dataConnection", "enum.controlCenterMenu.name.dataConnection", AccessLinkEnum.DATA_CONNECTION.getIcon(), AccessLinkEnum.DATA_CONNECTION.getUrl()),

    LOG_VIEW("logView", "enum.controlCenterMenu.name.log_view", AccessLinkEnum.LOG_VIEW.getIcon(), AccessLinkEnum.LOG_VIEW.getUrl()),

    DATA_CENTER("dataCenter", "enum.controlCenterMenu.name.data_center", AccessLinkEnum.DATA_CENTER.getIcon(), AccessLinkEnum.DATA_CENTER.getUrl()),

    DATA_SET("dataSet", "enum.controlCenterMenu.name.data_set", AccessLinkEnum.DATA_SET.getIcon(), AccessLinkEnum.DATA_SET.getUrl()),

    FINE_CLUE("fineClue", "enum.controlCenterMenu.name.fine_clue", AccessLinkEnum.FINE_CLUE.getIcon(), AccessLinkEnum.FINE_CLUE.getUrl()),

    CUSTOM_PAGE("customPage", "enum.controlCenterMenu.name.custom_page", AccessLinkEnum.CUSTOM_PAGE.getIcon(), AccessLinkEnum.CUSTOM_PAGE.getUrl()),

    TAG_SET("tagSet", "enum.controlCenterMenu.name.tag_set", AccessLinkEnum.TAG_SET.getIcon(), AccessLinkEnum.TAG_SET.getUrl()),

    CONTRACT_COMPARE("contractCompare","enum.controlCenterMenu.name.contractCompare",AccessLinkEnum.CONTRACT_COMPARE.getIcon(), AccessLinkEnum.CONTRACT_COMPARE.getUrl()),

    WORK_ORDER_V2_CENTER("workOrderV2CenterSet", "enum.controlCenterMenu.name.work_order_v2_center", AccessLinkEnum.WORK_ORDER_V2_CENTER.getIcon(), AccessLinkEnum.WORK_ORDER_V2_CENTER.getUrl()),

    /**
     * wps在线编辑
     */
    CONTRACT_MANAGE("onlineEditorManageView", "enum.controlCenterMenu.name.contract_manage", AccessLinkEnum.CONTRACT_MANAGE.getIcon(), AccessLinkEnum.CONTRACT_MANAGE.getUrl()),

    ;
    /**
     * 此枚举的唯一标识，也是和ProPermissionAliasEnum中的alias一致，可用于判断组织权限-角色权限-管理中心是否数据此权限
     */
    private String alias;

    private String name;

    private String icon;

    private String url;

    ControlCenterMenuEnum(String alias, String name, String icon, String url) {
        this.alias = alias;
        this.name = name;
        this.icon = icon;
        this.url = url;
    }

    public static ControlCenterMenuEnum  getControlCenterMenuEnum(String alias){
        for(ControlCenterMenuEnum controlCenterMenuEnum: values()){
            if(controlCenterMenuEnum.getAlias().equals(alias)){
                return controlCenterMenuEnum;
            }
        }
        return null;
    }

    public static List<String> getLowCodeList() {
        return Arrays.asList(ControlCenterMenuEnum.SERVICE_REGISTRATION.getAlias(), ControlCenterMenuEnum.DEVELOPER.getAlias());
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }

    public String getI18nName() {
        return name;
    }
}
